import { RouteRecordRaw, createRouter, createWebHashHistory } from 'vue-router'
import { setupBeforeEach, setupAfterEach } from './routerGuard'
import generateAsyncRoutes from './generateAsyncRoutes'
import routes from './commonRoutes'

const router = createRouter({
  history: createWebHashHistory(),
  routes: routes as unknown as RouteRecordRaw[]
})
generateAsyncRoutes(router)
// 路由守卫,鉴权
setupBeforeEach(router)

setupAfterEach(router)

export default router
